package com.springboot.caiji.util;

import java.io.Serializable;

public class ResultView<T> implements Serializable {

    private Integer code;

    private Integer errorNo;

    private String msg;

    private T data;

    private long time;

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public Integer getErrorNo() {
        return errorNo;
    }

    public void setErrorNo(Integer errorNo) {
        this.errorNo = errorNo;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }

    public long getTime() {
        return time;
    }

    public void setTime(long time) {
        this.time = time;
    }

    public static <T> ResultView<T> ok(T data) {
        return new ResultView(data);
    }

    public static <T> ResultView<T> ok() {
        return new ResultView();
    }

    public static <T> ResultView<T> error(String errMsg) {
        return new ResultView(errMsg);
    }


    private ResultView() {
        this.data = data;
        this.code = 0;
        this.errorNo = 0;
        this.msg = "ok";
        this.time = System.currentTimeMillis();
    }

    private ResultView(T data) {
        this.data = data;
        this.code = 0;
        this.errorNo = 0;
        this.msg = "ok";
        this.time = System.currentTimeMillis();
    }


}
